﻿@using System.Data.Entity;
@using eLoan.Models;
@model LoanPaymentSchedule

@{
    ViewBag.Title = "Edit Loan Payment Schedule";
    var documentNo = ViewBag.DocumentNo;
    var command = ViewBag.Command;
    var chargeTypes = (IEnumerable<SelectListItem>)ViewData["chargeTypes"];
}

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>Add/Edit Loan Payment Schedule</h2>
        <ol class="breadcrumb">
            <li>
                Funding
            </li>
            <li>
                <a href="@Url.Action("Loans", "Funding")">Loans</a>
            </li>
            <li>
                <a href="@Url.Action("LoanPayments", "Loan", new { documentNo = documentNo })">Loan Payments</a>
            </li>
            <li class="active">
                <strong>Add/Edit Loan Payment Schedule</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2"></div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-8">
            <div class="ibox float-e-margins">
                <div class="ibox-content">

                    @using (Html.BeginForm("Save", "LoanPaymentSchedule", FormMethod.Post, new { id = "saveForm" }))
                    {
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true)

                        <fieldset>

                            <table class="table table-striped">
                                <tr>
                                    <th>
                                        @Html.HiddenFor(m => m.ID)
                                        @Html.HiddenFor(m => m.DocumentNo, new { @value = documentNo })
                                        @Html.LabelFor(m => m.DueDate)
                                    </th>
                                    <td>
                                        @Html.HiddenFor(m => m.DueDate)
                                        @Html.ValueFor(m => m.DueDate, "{0:dd/MMM/yyyy}")
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.ScheduledAmount)</th>
                                    <td>
                                        @Html.HiddenFor(m => m.ScheduledAmount)
                                        @Html.ValueFor(m => m.ScheduledAmount, "{0:#,###,##0.00}") 
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td>@Html.LabelFor(m => m.ChargeTypeID)</td>
                                    <td>@Html.DropDownListFor(m => m.ChargeTypeID, chargeTypes, new { @class = "text-box single-line" })</td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.OtherCharges)</th>
                                    <td>@Html.TextBoxFor(m => m.OtherCharges, new { @id = "txtOtherCharges", @class = "text-box single-line" })</td>
                                    <td>@Html.ValidationMessageFor(m => m.OtherCharges)</td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.DueAmount)</th>
                                    <td>@Html.ValueFor(m => m.DueAmount, "{0:#,###,##0.00}")</td>
                                    <td></td>
                                </tr>
                            </table>

                            <p></p>

                            <button type="submit" id="btnSave" class="btn btn-primary" name="afterSave" value="Edit,@documentNo">Save</button>
                            <button type="submit" id="btnCancel" class="btn btn-primary cancel" name="afterSave" value="Cancel,@documentNo">Cancel</button>

                        </fieldset>
                    }

                </div>
            </div>

        </div>
    </div>
</div>

@section Styles {
    @Styles.Render("~/plugins/dataPickerStyles")
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/plugins/dataPicker")

}
